package com.smommo.myapp.aware;

import org.springframework.beans.BeansException;
import org.springframework.beans.factory.BeanClassLoaderAware;
import org.springframework.beans.factory.BeanFactory;
import org.springframework.beans.factory.BeanFactoryAware;
import org.springframework.beans.factory.BeanNameAware;
import org.springframework.stereotype.Component;


//感知接口，Spring提供的一种机制，通过实现该接口，重写方法，可以感知Spring应用程序执行过程中的一些变化
//。Springs会判断当前的Bean有没有实现Aware接口，如果实现了，会在特定的时机回调接口对应的方法

@Component
public class Stu implements BeanNameAware, BeanClassLoaderAware, BeanFactoryAware {
    @Override
    public void setBeanClassLoader(ClassLoader classLoader) {
        System.out.println("Stu......setBeanClassLoader"+classLoader);

    }

    @Override
    public void setBeanFactory(BeanFactory beanFactory) throws BeansException {
        System.out.println("Stu......setBeanFactory"+beanFactory);

    }

    @Override
    public void setBeanName(String name) {
        System.out.println("Stu......setBeanName"+name);

    }
}
